﻿using System;
using System.Collections.Generic;
using Yun.Interface;
using Yun.Response;
using Yun.Util;

namespace Yun.Marketing.Request
{
    /// <summary>
    /// 新建红包
    /// yun.game.redpackets.add
    /// </summary>
    public class AddRedPacketsRequest : ITopRequest<IntResultResponse>
    {
        /// <summary>
        /// 批号
        /// </summary>
        public string BatchNo { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 红包分配方式，0：随机，1：平均
        /// </summary>
        public int ModeOfDistribution { get; set; }


        /// <summary>
        /// 红包资金类型
        /// </summary>
        public int RedEnvelopeFunds { get; set; }


        /// <summary>
        /// 总数量
        /// </summary>
        public int TotalQuantity { get; set; }


        /// <summary>
        /// 红包总金额
        /// 现金和积分均采用最小单位，现金单位为分
        /// </summary>
        public int TotalAmount { get; set; }


        /// <summary>
        /// 指定的领红包人员，多个用英文逗号分隔
        /// </summary>
        public string ReceivingPersonnel { get; set; }


        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }


        /// <summary>
        /// 币种
        /// </summary>
        public string Currency { get; set; }


        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTime? ExpiredTime { get; set; }


        /// <summary>
        /// 余额
        /// </summary>
        public int OverMoney { get; set; }


        /// <summary>
        /// 充值卡金额
        /// </summary>
        public int PrepaidCardMoney { get; set; }


        /// <summary>
        /// 外部现金
        /// </summary>
        public int CashMoney { get; set; }


        /// <summary>
        /// 在线支付
        /// </summary>
        public int OnlineMoney { get; set; }

        /// <summary>
        /// 支付单附加数据，在查询API和支付通知中原样返回，可作为自定义参数使用。
        /// </summary>
        public string PaymentAttach { get; set; }

        /// <summary>
        /// 积分类型，如果支付方式是积分，那会将该参数直接传入积分交易信息中
        /// </summary>
        public string IntegralType { get; set; }

        public IDictionary<string, string> GetParameters()
        {
            var parameters = new YunDictionary
            {
                {"batchno", BatchNo},
                {"remark", Remark},
                {"modeofdistribution", ModeOfDistribution},
                {"redenvelopefunds", RedEnvelopeFunds},
                {"totalquantity", TotalQuantity},
                {"totalamount", TotalAmount},
                {"receivingpersonnel", ReceivingPersonnel},
                {"starttime", StartTime},
                {"expiredtime", ExpiredTime},
                {"currency",Currency },
                {"overmoney",OverMoney },
                {"prepaidcardmoney",PrepaidCardMoney },
                {"cashmoney",CashMoney },
                {"onlinemoney",OnlineMoney },
                {"paymentattach",PaymentAttach },
                {"integraltype",IntegralType }
            };
            return parameters;
        }


        public void Validate()
        {
            RequestValidator.ValidateRequired("batchno", BatchNo);
        }


        public string GetApiName()
        {
            return "yun.game.redpackets.add";
        }
        
    }
}
